/**══════════════════════════════════╗
*作    者：songbaobao                                                  ║
*职    业：我以我血荐轩辕                                              ║
*CSND地址：https://blog.csdn.net/weixin_43949535                       ║
**GitHub ：https://github.com/TsinghuaLucky912/My_own_C-_study_and_blog║
**GitEE  ：https://gitee.com/lucky912_admin/code-up_-pat               ║
*═══════════════════════════════════╣
*创建时间：                                                           
*功能描述：                                                            
*                                                                      
*                                                                      
*═══════════════════════════════════╣
*结束时间:                                                           
*═══════════════════════════════════╝
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//              西南\./联大               \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
*/
#include <iostream>
#include <vector>
#include <string.h>
#include <unordered_map>
#include <ctype.h>
#include <queue>
#include <list>
#include <stdlib.h>
#include <map>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdbool.h>
using namespace std;

char mylower(char c)
{
	if (c <= 'Z' && c >= 'A')
	{
		c = c - 'A' + 'a';
		return c;
	}
}

int main()
{
#if I
	char str[256] = { 0 };
	while (~scanf("%s", str))
	{
		bool flag = true;
		int len = strlen(str);
		for (int i = 0; i < len / 2; ++i)
		{
			if (str[i] != str[len - 1 - i])
				flag = false;
		}
		if (flag)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		memset(str, 0, 256 * sizeof(char));
	}
#endif

#if A
	char str1[101] = { 0 };
	char str2[101] = { 0 };

	while (~scanf("%s%s", str1, str2))
	{
		char result[203] = { 0 };
		int j = 0;

		for (int i = 0; str1[i]!='\0'; ++i)
		{
			result[j++] = str1[i];
		}

		for (int i = 0; str2[i] != '\0'; ++i)
		{
			result[j++] = str2[i];
		}

		result[j] = '\0';
		printf("%s\n", result);

		memset(str1, 0, 101 * sizeof(char));
		memset(str2, 0, 101 * sizeof(char));
	}
#endif

#if B
	char str[101];
	int len = 0;
	while (gets_s(str))
	{
		len = strlen(str);
		bool flag = true;
		for (int i = 0; i < len; ++i)
		{
			if (str[i] >= 'a' && str[i] <= 'z')
			{
				if (i == 0 || str[i - 1] == ' ' || str[i - 1] == '\n' || str[i - 1] == '\r' || str[i - 1] == '\t'
					|| str[i - 1] == '.' || str[i - 1] == ',')
					str[i] = str[i] - 32;
			}
			printf("%c", str[i]);
		}
		printf("\n");
	}
#endif	

#if H
	int m, num = 0;
	scanf("%d", &m);
	char mystr[101][21];
	while (m--)
	{
		scanf("%s", mystr[num++]);
	}
	for (int i = 0; i <= num - 1; ++i)
	{
		int index = 1;
		if (i >= 3)
		{
			bool first = true;
			for (int j = i;index != 5; --j)
			{
				if (first)
				{
					first = false;
					printf("%d=%s", index++, mystr[j]);
				}
				else
					printf(" %d=%s", index++, mystr[j]);
			}
			printf("\n");
		}
		else
		{
			bool first = true;
			for (int j = i; j >= 0; --j)
			{
				if (first)
				{
					first = false;
					printf("%d=%s", index++, mystr[j]);
				}
				else
					printf(" %d=%s", index++, mystr[j]);
			}
			printf("\n");
		}
	}
#endif

#if G
	int m;
	scanf("%d", &m);

	while (m--)
	{
		char mystr[2][51];
		int len1, len2;
		for (int i = 0; i < 2; ++i)
		{
			scanf("%s", mystr[i]);
		}

		len1 = strlen(mystr[0]);
		len2 = strlen(mystr[1]);

		if (len1 == len2)
		{
			printf("%s is equal long to %s\n", mystr[0], mystr[1]);
		}
		else if (len1 > len2)
		{
			printf("%s is longer than %s\n", mystr[0], mystr[1]);
		}
		else
		{
			printf("%s is shorter than %s\n", mystr[0], mystr[1]);
		}
	}
#endif

#if F
	char mystr[201] = { 0 };
	while (gets_s(mystr) != NULL)
	{
		int len = 0;
		while (mystr[len] != '\0')
		{
			len++;
		}
		for (int i = len - 1; i >= 0; --i)
		{
			printf("%c", mystr[i]);
		}
		printf("\n");
	}
#endif

#if E
	char mystr[201] = { 0 };
	while (gets_s(mystr)!=NULL)
	{
		int len = 0;
		char c;
		scanf("%c", &c);
		getchar();// 这个地方主要是干掉 scanf后面的那个回车符号
		while (mystr[len] != '\0')
		{
			len++;
		}
		for (int i = 0; i < len; ++i)
		{
			if (mystr[i] != c)
				printf("%c", mystr[i]);
		}
		printf("\n");
		memset(mystr, 0, 201 * sizeof(char));
	}
#endif

#if D
	char str[1001] = { 0 };
	
	while (gets_s(str) != NULL)
	{
		char mystr[1001][1001];

		int row = 0, col = 0, len = strlen(str);
		
		for (int i = 0; i <= len; ++i)
		{
			if (i<len && str[i] != ' ')
				mystr[row][col++] = str[i];
			else if (i == strlen(str) || str[i] == ' ')
			{
				mystr[row][col] = '\0';
				row++;
				col = 0;
			}
		}

		char target[1001] = { 0 };
		gets_s(target);

		char word[1001] = { 0 };
		gets_s(word);

		for (int i = 0; i < row; ++i)
		{
			if (0 == strcmp(mystr[i], target))
			{
				if (i == 0)
					printf("%s", word);
				else
					printf(" %s", word);
			}
			else
			{
				if (i == 0)
					printf("%s", mystr[i]);
				else
					printf(" %s", mystr[i]);
			}
		}
		printf("\n");
		memset(str, 0, 1001 * sizeof(char));
	}
#endif

#if C
	char str1[1001] = { 0 };
	char str2[1001] = { 0 };

	gets_s(str1);
	for (int i = 0; i < strlen(str1); ++i)
	{
		if (str1[i] <= 'Z' && str1[i] >= 'A')
		{
			str1[i] = str1[i] - 'A' + 'a';
		}
	}

	while (gets_s(str2) != NULL)
	{
		int len = strlen(str1);

		for (int i = 0; i < strlen(str2); )
		{
			bool flag = false;
			if (mylower(str2[i]) == str1[0])
			{
				for (int j = 0; j < len; ++j)
				{
					if (mylower(str2[j + i]) == str1[j])
					{
						flag = true;
					}
					else
					{
						flag = false;

						if (str2[i] != ' ')
							printf("%c", str2[i]);
						i++;

						break;
					}
				}
			}
			else
			{
				if (str2[i] != ' ')
					printf("%c", str2[i]);
				i++;
			}
			if (flag)
			{
				i += len;
			}
		}
		printf("\n");
	}
#endif
	return 0;
}
/**
*备用注释：
*
*
*
*/
